<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "edu_user".
 *
 * @property integer $user_id
 * @property integer $user_num
 * @property string $user_email
 * @property string $user_phone
 * @property string $user_name
 * @property string $user_pwd
 * @property integer $user_status
 * @property integer $user_regtime
 * @property integer $user_lastlogin
 * @property string $user_lastip
 * @property integer $user_updtime
 * @property integer $user_sex
 * @property string $user_sign
 * @property integer $user_virtual
 * @property integer $province_id
 * @property integer $city_id
 * @property integer $area_id
 * @property string $user_thumb
 * @property integer $user_qq
 * @property string $user_emid
 * @property string $user_openid
 * @property string $user_opentype
 */
class User extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%user}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_num','user_opentype','user_phone', 'user_status', 'user_regtime', 'user_lastlogin', 'user_updtime', 'user_sex', 'user_virtual', 'province_id', 'city_id', 'area_id', 'user_qq'], 'integer'],
            [['user_sign'], 'string'],
            [['user_email'], 'string', 'max' => 40],
            [['user_name'], 'required','message'=>'当前项不能为空'],
            [['user_name'], 'match', 'pattern' => '/^([\x{4e00}-\x{9fa5}]|\w){2,18}$/u', 'message' => '昵称为2-18位,中英文、数字、下划线'],
            [['user_name'], 'unique', 'message'=>'昵称已存在'],
            [['user_pwd'], 'string', 'max' => 32],
			[['user_regip'], 'string', 'max' => 15],
            [['user_lastip'], 'string', 'max' => 15],
			[['user_emid'], 'string', 'max' => 32],
            [['user_thumb'], 'string', 'max' => 255],
            [['user_openid'], 'string', 'max' => 64]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'user_id' => '',
            'user_num' => '',
            'user_email' => '邮箱:',
            'user_phone' => '手机:',
            'user_name' => '昵称:',
            'user_pwd' => '',
            'user_status' => '',
            'user_regtime' => '',
            'user_lastlogin' => '',
            'user_lastip' => '',
			'user_regip' => '',
            'user_updtime' => '',
            'user_sex' => '性别:',
            'user_sign' => '个人签名:',
            'user_virtual' => '',
            'province_id' => '',
            'city_id' => '',
            'area_id' => '',
            'user_thumb' => '',
            'user_qq' => '',
            'user_emid' => '',
            'user_openid' => '',
            'user_opentype' => '',
        ];
    }
}
